package com.sc.nft.mapper;

import com.sc.nft.dto.MallActivitySpecsGetSendCodeDTO;
import com.sc.nft.entity.MallActivitySpecs;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
 * IP商城活动规格表(sc_mall_activity_specs)数据Mapper
 *
 * @author zxy
 * @description IP商城
 * @since 2023-05-10 16:59:01
 */
@Mapper
public interface MallActivitySpecsMapper extends BaseMapper<MallActivitySpecs> {

    /**
     * 冻结库存 (可用库存-1，冻结库存+1)
     *
     * @param id
     * @param count
     * @return
     */
    Boolean frozenStockByIdAndCount(@Param("id") Long id, @Param("count") Integer count);

    /**
     * 冻结库存释放(冻结库存-1，可用库存+1)
     *
     * @param id
     * @param count
     * @return
     */
    Boolean subFrozenCount(@Param("id") Long id, @Param("count") Integer count);

    /**
     * 冻结消费库存(冻结库存-1)
     *
     * @param id
     * @param count
     * @return
     */
    Boolean frozenConsumeStockByIdAndCount(@Param("id") Long id, @Param("count") Integer count);

    /**
     * 出入库存
     *
     * @param addCount 添加库存数量
     * @return
     */
    Boolean updateUsableStockCountById(@Param("id") Long id, @Param("addCount") Integer addCount);

    /**
     *
     * @param activitySpecsId
     * @return
     */
    MallActivitySpecs getByIdWithoutDeleted(@Param("id") Long activitySpecsId);

    List<MallActivitySpecsGetSendCodeDTO> getSendCodeByActivitySpecsIdList(@Param("activitySpecsIdList") List<Long> activitySpecsIdList);
}
